home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 49
/
Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso
/
-serious-
/
comms
/
other
/
amigancp_21
/
developer
/
source
/
ncplib
/
openncp.c
next >
Wrap
C/C++ Source or Header
|
1999-11-29
|
1KB
|
60 lines
/*
** SAS/C 6.5x constructor for opening
** "ncp.library"
**/
#include <constructor.h>
#define __USE_SYSBASE
#include <proto/exec.h>
#include <exec/execbase.h>
#include <proto/intuition.h>
#include <proto/dos.h>
#include <libraries/ncplib.h>
#include <string.h>
struct Library *NCPBase;
static struct Library *libbase;
CONSTRUCTOR_P(ncplib,500)
{
struct EasyStruct eas;
char buffer[ 128 ];
struct Task *pr = FindTask( NULL );
if( SysBase->LibNode.lib_Version < 37 )
return( 1 );
FOREVER
{
libbase = OpenLibrary( NCP_NAME, NCP_VERSION );
if( !libbase )
libbase = OpenLibrary( "PROGDIR:" NCP_NAME, NCP_VERSION );
if( !libbase )
libbase = OpenLibrary( "PROGDIR:Libs/" NCP_NAME, NCP_VERSION );
if( libbase )
{
NCPBase = libbase;
return( 0 );
}
eas.es_StructSize = sizeof( eas );
eas.es_Flags = 0;
eas.es_Title = buffer;
buffer[ 127 ] = 0;
if( !GetProgramName( buffer, 127 ) )
strncpy( buffer, pr->tc_Node.ln_Name, 127 );
eas.es_TextFormat = "Requires V%ld (or higher))\nof \"" NCP_NAME "\"";
eas.es_GadgetFormat = "Retry|Cancel";
if( !EasyRequest( NULL, &eas, NULL, NCP_VERSION ) )
return( 1 );
}
}
DESTRUCTOR_P(ncplib,500)
{
if (libbase)
{
CloseLibrary((struct Library *)libbase);
libbase = NCPBase = NULL;
}
}